package com.example.datn.activities;



import com.example.datn.R;
import com.example.datn.adapter.AlbumPhotoAdapter;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class AlbumPhotoActivity extends Activity {
	GridView gridView;
	 
	static final String[] ALBUMS = new String[] { 
		"Quang Lê với Phương Mỹ Chi", "Quang Lê song ca cùng mỹ nhân","CD không phải tại chúng mình", "Quang lê xuân trên quê hương",
		"Quang Lê hát trên quê hương"};
 
	@Override
	public void onCreate(Bundle savedInstanceState) {
 
		super.onCreate(savedInstanceState);
		setContentView(R.layout.album_photo);
 
		gridView = (GridView) findViewById(R.id.gridView1);
 
		gridView.setAdapter(new AlbumPhotoAdapter(this, ALBUMS));
 
		gridView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
					int position, long id) {
			
				
				
		Intent intenphoto= new Intent(AlbumPhotoActivity.this,PhotoActivity.class);
		
		intenphoto.putExtra("a", position);
		startActivity(intenphoto);
				

		System.out.println("Vitri:         "+position);
//				
//				Toast.makeText(
//				   getApplicationContext(),
//				   ((TextView) v.findViewById(R.id.grid_item_label))
//				   .getText(), Toast.LENGTH_SHORT).show();
 
			}
		});
 
	}
}
